import 'package:flutter/cupertino.dart';
import 'package:provider/provider.dart';

import 'gt_theme_provider.dart';

class GTColorPair {

  final Color light;
  final Color dark;

  /// 自动根据主题返回对应色值
  Color get color => GTThemeProvider.instance.isDark() ? dark : light;

  const GTColorPair({required this.light, required this.dark});

  // fixme 开销很小暂时忽略
  Color of(BuildContext context) {
    final isDark = context.read<GTThemeProvider>().isDark();
    return isDark ? dark : light;
  }

  Color get(bool isDark) {
    return isDark ? dark : light;
  }
}
